//
//  CharacterLayer.h
//  ATM Killer
//
//  Created by USoft on 7/25/14.
//
//

#ifndef CHARACTER_LAYER_H
#define CHARACTER_LAYER_H
#include "AbstractLayer.h"
using namespace extension;
class CharacterLayer : public AbstractLayer {
    UG_PROPERTY_FULL(MenuItemSprite*,levelUpButton, LevelUpButton);
    UG_PROPERTY_FULL(MenuItemSprite*, okButton, OkButton);
    UG_PROPERTY_FULL(MenuItemSprite*, cancelButton, CancelButton);
    UG_PROPERTY_FULL(__Array*, tabArray, TabArray);
    UG_PROPERTY_FULL(__Array*, avatarArray, AvatarArray);
    UG_PROPERTY_FULL(bool,isPopUpShow,IsPopUpShow);
protected:
    UGLayerColor* grayLayer;
    UGLayer* mainLayer;
    UGLayer* popUpLayer;
    UGLayer* upgradeLayer;
    ScrollView* upgradeContentView;
    Face* characterBoard;
    Face* informationTab;
    Face* characterFace;
    Face* popUpFace;
    Face* upgradePopUpFace;
    int currentCharacterID;
    void onTouchesBegan(const std::vector<Touch*>& touches, Event* event);
    void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
private:
    CharacterLayer();
    ~CharacterLayer();
    void createLayers();
    void createLayersContent();
    
    virtual void onEnter();
    virtual void onExit();
    void fadeObject(int fade, Obj* obj);
    void showLevelUpPopUp(Ref* sender);
    void showUpgradePopUp(Ref* sender);
    void cancelPopUp(Ref* sender);
    void onButtonClick(Ref* sender);
    void touchesRegister();
    void createUpgradeTabs();
public:
    CREATE_FUNC(CharacterLayer);
    void update(float dt);
    void loadCharacterBoard();
    
};

#endif /* defined(__ATM_Killer__CharacterLayer__) */
